package com.pfzy.ui.utils;

import android.os.Handler;
import android.os.Looper;

public class UiThread {
    private static Handler handler = new Handler(Looper.getMainLooper());

    /**
     * 运行UI延迟
     */
    public static void runUI(Runnable runnable) {
        runUIDelayed(runnable, 0L);
    }

    /**
     * 运行UI延迟
     */
    public static void runUIDelayed(Runnable runnable, long time) {
        handler.postDelayed(runnable, time);
    }

    public static void removeCallback(Runnable runnable) {
        handler.removeCallbacks(runnable);
    }

    public static void clearCallBack() {
        handler.removeCallbacksAndMessages(null);
    }
}
